package com.moses.main;

import com.sun.tools.attach.AgentInitializationException;
import com.sun.tools.attach.AgentLoadException;
import com.sun.tools.attach.AttachNotSupportedException;
import com.sun.tools.attach.VirtualMachine;

import java.io.IOException;

public class Main {

    public static void main(String[] args) {
        String jid = args[0];
        String path = args[1];

        System.out.println(jid);
        System.out.println(path);

        try {
            VirtualMachine attach = VirtualMachine.attach(jid);
            attach.loadAgent(path);
            attach.detach();
        } catch (AttachNotSupportedException | AgentLoadException | AgentInitializationException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
